const store = {
    state:{
        num: 1
    },
    actions:{
        add(newState:{num:number},action:{type:string,val:number}){
            newState.num += action.val
        },
        add2(newState:{num:number},action:{type:string}){
            newState.num++;
        }
    },
    asyncActions:{
        asyncAdd(dispatch:Function){
            setTimeout(() =>{
                dispatch({type: 'add2'});
            },1000)
        }
    },
    actionNames:{}
}

const actionNames = {};

for(let key in store.actions){
    actionNames[key] = key
}

store.actionNames = actionNames

export default store